import VueRouter, {createRouter, createWebHistory} from "vue-router";

const routes = [
    {
        path: '/',
        name: 'direct',
        components:{
            app:()=>import("../components/component/Login.vue")
        }
    },
    {
        path: '/login',
        name: 'login',
        components:{
            app:()=>import("../components/component/Login.vue")
        }
    },
    {
        path: '/register',
        name: 'register',
        components:{
            app:()=>import("../components/component/Register.vue")
        }
    },
    {
        path: '/user/home',
        name: 'userHome',
        components:{
            app:()=>import("../components/userView/UserHome.vue")
        },
        children:[
            {
                path: '/user/map',
                name: 'map',
                components:{
                    user:()=>import("../components/userComponent/MyMap.vue")
                }
            },
            {
                path: '/user/imageUpload',
                name: 'imageUpload',
                components:{
                    user:()=>import("../components/userComponent/ImageUpload.vue")
                }
            },
            {
                path: '/user/imageUploadRecord',
                name: 'imageUploadRecord',
                components:{
                    user:()=>import("../components/userComponent/ImageUploadRecord.vue")
                }
            },
            {
                path: '/user/dataAnalyze',
                name: 'dataAnalyze',
                components:{
                    user:()=>import("../components/userComponent/DataAnalyze.vue")
                }
            },

        ]
    },
    {
        path: "/admin/home",
        name: "home",
        components:{
            app:()=>import("../components/view/Home.vue")
        },
        children:[
            {
                path: '/admin/uploadInfo',
                name: 'hot',
                components:{
                    admin:()=>import("../components/component/UploadInfo.vue")
                }
            },
            {
                path: '/admin/userInfo',
                name: 'userInfo',
                components:{
                    admin:()=>import("../components/component/UserInfo.vue")
                }
            },
            {
                path: '/admin/riceDistribution',
                name: 'riceDistribution',
                components:{
                    admin:()=>import("../components/component/RiceDistribution.vue")
                }
            },
        ]
    }
]

const router=createRouter({
    history:createWebHistory(),
    routes
})
export default router